package com.hopes.bizz.poll.statistic.controller;

import com.hopes.bizz.poll.monitor.service.PollMonitorSiteService;
import com.hopes.boss.common.core.util.R;
import com.hopes.boss.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/6/1 10:10
 * @Description:
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/statistic" )
@Tag(description = "statistic" , name = "监控点统计" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class PollMonitorSiteStatisticController {

    private final PollMonitorSiteService pollMonitorSiteService;

    /**
     * 监控点状态统计
     * @return R
     */
    @Operation(summary = "监控点状态统计" , description = "监控点状态统计" )
    @SysLog("监控点状态统计" )
    @GetMapping("/monitorSite")
    @PreAuthorize("@pms.hasPermission('poll_statistic_monitorSite_view')" )
    public R statisticMonitorSiteStatus() {
        return R.ok(pollMonitorSiteService.statisticMonitorSiteStatus());
    }

}
